package mtamarket;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;

import org.encog.neural.networks.BasicNetwork;

public class BobsUtility {

	public static boolean saveNetwork(BasicNetwork network){
		try{
			File out = new File(Config.DATA_FILENAME.replace(".csv", "") + ".out");
			ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream(out));
			oos.writeObject(network);
			oos.close();
			return true;
		}catch(Exception e){
			return false;
		}
	}
	
	public static BasicNetwork getNetwork(String fileName){
		BasicNetwork network;
		try{
			ObjectInputStream ois = new ObjectInputStream(new FileInputStream(new File(fileName)));
			network = (BasicNetwork) ois.readObject();
			ois.close();
			return network;
		}catch(Exception e){
			return null;
		}
	}
	
	
	
	
	
	
}
